<script>
import { getWarehouseList } from "../warehouse/api";
import { getBusinessList1 } from "../business/api";
import { getUsersList } from "../manList/api";

export default {
  data() {
    return {
      warehouseList: [],
      selectOpt: [],
      userList: [],
    };
  },
  created() {
    this.getWarehouseData();
    this.getSelectData();
    this.getUsersData();
  },

  methods: {
    // 用户
    getUsersData() {
      getUsersList({
        page: 1,
        limit: 99999,
      })
        .then((res) => {
          if (!res) return;
          this.userList = res.data;
        })
        .catch((err) => {
          console.log("TCL: getWarehouseList -> err", err);
        });
    },
    // 库
    getWarehouseData() {
      getWarehouseList({
        page: 1,
        limit: 99999,
      })
        .then((res) => {
          if (!res) return;
          this.warehouseList = res.data;
        })
        .catch((err) => {
          console.log("TCL: getWarehouseList -> err", err);
        });
    },
    // 商家
    getSelectData() {
      getBusinessList1({
        page: 1,
        limit: 99999,
      })
        .then((res) => {
          if (!res) return;
          const { data } = res;
          this.selectOpt = data;
        })
        .catch((err) => {
          console.log("TCL: getTableData -> err", err);
        });
    },
  },
};
</script>
